package com.zhss.concurrency;

import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @ClassName CopyOnWtireArrayListDemo
 * @Description TODO
 * @Author leejiliang
 * @DateTime 2021/7/7 14:28
 * @Version 1.0
 */
public class CopyOnWtireArrayListDemo {
	public static void main(String[] args) {
		final CopyOnWriteArrayList<String> list = new CopyOnWriteArrayList<>();
		list.add("张三");
		list.set(0, "李四");
		list.remove("李四");
		list.add(1, "王五");
		list.get(0);
		final Iterator<String> iterator = list.iterator();
		while (iterator.hasNext()) {
			final String next = iterator.next();
		}
	}
}
